(function(){
  var mapCenter =  {x:126.5358247345,y:45.8021755616};
  var defaultLevel = 6;
  var defaultCity = '哈尔滨'
  var defaultImgSrc = "http://120.77.223.190/gisapi/resources/images/gis/icon/marker_large.png"
  var options = {
    center: new beyond.geometry.MapPoint(mapCenter.x, mapCenter.y),
    zoom: defaultLevel,
    minZoom: 0,
    maxZoom: 17
  }
  var marker
  var mapLoaded = function(){
    addMarks()
  }
  var addMarks = function(){
    marker = new beyond.maps.Marker({
      position: new beyond.geometry.MapPoint(mapCenter.x, mapCenter.y),//位置
      icon: defaultImgSrc,//图标
      width: 20,//宽度
      height: 34,//高度
      editEnable: false,
      offsetX: 0,
      offsetY: 17
    });
    cmap.addOverlay(marker);
    marker.addEventListener("click", function (m) {
      // var infoWindow = new beyond.maps.BInfoWindow({isCustom:true,content:`<div id="container" style="width: 600px;height:400px;"></div>`,offsetY:34});
      // infoWindow.open(cmap,marker.getPosition());
      addCharts()
    });
  }
  var addCharts = function(){
    var options = {
      chart: {
          type: 'bar'                          //指定图表的类型，默认是折线图（line）
      },
      title: {
          text: '我的第一个图表'                 // 标题
      },
      xAxis: {
          categories: ['苹果', '香蕉', '橙子']   // x 轴分类
      },
      yAxis: {
          title: {
              text: '吃水果个数'                // y 轴标题
          }
      },
      series: [{                              // 数据列
          name: '小明',                        // 数据列名
          data: [1, 0, 4]                     // 数据
      }, {
          name: '小红',
          data: [5, 7, 3]
      }]
    };
    // 图表初始化函数
    var chart = Highcharts.chart('container', options);
  }
  var cmap=new beyond.maps.Map("mapContainer",options, mapLoaded);
  
})()